import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class AppWidget extends StatefulWidget {
  final Widget child;
  final Size designSize;
  final SystemUiOverlayStyle? systemUiOverlayStyle;

  const AppWidget({super.key, required this.child, required this.designSize, this.systemUiOverlayStyle});

  @override
  State<AppWidget> createState() => _AppWidgetState();
}

class _AppWidgetState extends State<AppWidget> {
  @override
  Widget build(BuildContext context) {
    return ScreenUtilInit(
      designSize: widget.designSize,
      builder: (context, child) {
        if (widget.systemUiOverlayStyle != null) {
          return AnnotatedRegion<SystemUiOverlayStyle>(value: widget.systemUiOverlayStyle!, child: widget.child);
        }
        return widget.child;
      },
    );
  }
}
